import { channel } from "~/config/env"
// ********************************商品管理
/**
 * 接口名称： findGoodsList
 * 接口用途： 获取商品列表信息
 * isReal//1.售卖中 2售完下架 3我下架的
 * is_on_sale//1未上架
 * @param  {} app
 */
export const findGoodsList = (app,goodsName,shopPriceUp,shopPriceFloor,isOnSale,isReal,shopId,catId) => app.$axios.$post(`/api/${channel}/supply/goods/app1.0/findGoodsList`,{
  goodsName,shopPriceUp,shopPriceFloor,isOnSale,isReal,shopId,catId
})

/**
 * 接口名称： addGoods
 * 接口用途： 添加商品信息
 * @param  {} app
 */
export const addGoods = (app, goodsName,rebateCycle,goodsImg,goodsAttrList,goodsDesc,supplyServiceGoodsList,purchaseCategoryGoodsList,shopCategoryGoodsList) => app.$axios.$post(`/api/${channel}/supply/goods/app1.0/addGoods`, {
  goodsName,rebateCycle,goodsImg,goodsAttrList,goodsDesc,supplyServiceGoodsList,purchaseCategoryGoodsList,shopCategoryGoodsList
})

/**
 * 接口名称： updateGoods
 * 接口用途： 修改商品信息
 * @param  {} app
 */
export const updateGoods = (app) => app.$axios.$post(`/api/${channel}/supply/goods/app1.0/updateGoods`)

/**
 * 接口名称： deleteGoods
 * 接口用途： 删除商品服务
 * @param  {} app
 * @param  {} id
 */
export const deleteGoods = (app, id) => app.$axios.$delete(`/api/${channel}/supply/goods/app1.0/deleteGoods/${id}`)


export const findGoodsOrderGoodsList = (app) => app.$axios.$get(`/api/${channel}/supply/goodsOrderGoods/app1.0/findGoodsOrderGoodsList`)

/**
 * 接口名称： addGoodsOrderGoods
 * 接口用途： 订单商品添加
 * @param  {} app
 * @param  {} {recId
 * @param  {} orderId
 * @param  {} goodsId
 * @param  {} goodsName
 * @param  {} goodsNo
 * @param  {} productId
 * @param  {} goodsNumber
 * @param  {} marketPrice
 * @param  {} goodsPrice
 * @param  {} goodsAttr
 * @param  {} sendNumber
 * @param  {} isReal
 * @param  {} extensionCode
 * @param  {} parentId
 * @param  {} isGift
 * @param  {} goodsAttrId}
 */
export const addGoodsOrderGoods = (app, {
    recId,
    orderId,
    goodsId,
    goodsName,
    goodsNo,
    productId,
    goodsNumber,
    marketPrice,
    goodsPrice,
    goodsAttr,
    sendNumber,
    isReal,
    extensionCode,
    parentId,
    isGift,
    goodsAttrId
  }) => app.$axios.$post(`/api/${channel}/supply/goodsOrderGoods/app1.0/addGoodsOrderGoods`, {
  recId, orderId, goodsId, goodsName, goodsNo, productId, goodsNumber, marketPrice, goodsPrice,
  goodsAttr, sendNumber, isReal, extensionCode, parentId, isGift, goodsAttrId
})

/**
 * 接口名称： findGoodsCartList
 * 接口用途： 商品查询
 * @param  {} app
 */
export const findGoodsCartList = (app) => app.$axios.$get(`/api/${channel}/supply/goodsCart/app1.0/findGoodsCartList`)

/**
 * 接口名称： addGoodsCart
 * 接口用途： 购物车商品添加
 * @param  {} app
 * @param  {} {userId
 * @param  {} sessionId
 * @param  {} goodsId
 * @param  {} goodsNo
 * @param  {} productId
 * @param  {} goodsName
 * @param  {} marketPrice
 * @param  {} goodsPrice
 * @param  {} goodsNumber
 * @param  {} goodsAttr
 * @param  {} isReal
 * @param  {} recordType
 * @param  {} isGift
 * @param  {} isShipping
 * @param  {} canHandsel
 * @param  {} goodsAttrId}
 */
export const addGoodsCart = (app, {
    userId,
    sessionId,
    goodsId,
    goodsNo,
    productId,
    goodsName,
    marketPrice,
    goodsPrice,
    goodsNumber,
    goodsAttr,
    isReal,
    recordType,
    isGift,
    isShipping,
    canHandsel,
    goodsAttrId
  }) => app.$axios.$post(`/api/${channel}/supply/goodsCart/app1.0/addGoodsCart`, {
  userId, sessionId, goodsId, goodsNo, productId, goodsName, marketPrice, goodsPrice, goodsNumber, goodsAttr, isReal,
  recordType, isGift, isShipping, canHandsel, goodsAttrId
})

/** 
*接口名称：findGoodsOrderInfoList
*接口用途：订单列表
 * @param  {} app
*  @param  {} {lowPrice
 * @param  {} hirePrice
 * @param  {} startTime
 * @param  {} endTimd
 * @param  {} consignee
 * @param  {} orderStatus
 * @param  {} shippingStatus
 * @param  {} pay_status
 * @param  {} rank
 * @param  {} rankName
 * @param  {} supplyUser
 * @param  {} goodsName}
*/
export const findGoodsOrderInfoList =(app,{
    lowPrice,
    hirePrice,
    startTime,
    endTimd,
    consignee,
    orderStatus,
    shippingStatus,
    pay_status,
    rank,
    rankName,
    supplyUser,
    goodsName
})=>app.$axios.post(`/api/${channel}/supply/goodsCart/app1.0/findGoodsOrderInfoList`,{lowPrice,hirePrice,startTime, endTimd,consignee, orderStatus,
  shippingStatus,pay_status,rank,rankName,supplyUser,goodsName})
  /**
 * 接口名称： findFavourableList
 * 接口用途： 供应端获取活动列表信息
 * @param  {} app
 * @param  {} actName
 * @param  {} actStatus
 */
export const findFavourableList = (app, actName, actStatus, pageNum, pageSize) => app.$axios.$post(`/api/${channel}/supply/favourable/app1.0/findFavourableList`, {
  actName, actStatus, pageNum, pageSize
})
  /**
 * 接口名称： newsList
 * 接口用途： 供应端获取新闻列表信息
 * @param  {} app
 * @param  {} actName
 * @param  {} actStatus
 */
export const newsList = (app) => app.$axios.$post('http://localhost:3000/newslist')